.#{$ns}CBGroup {
  font-size: $fontSizeSm;

  &-toolbar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding-bottom: 10px;

    .#{$ns}Button {
      transition: padding 0.2s;

      svg {
        width: 10px;
        height: 10px;
        top: 0;
        margin-right: 5px;
      }
    }

    &:not(:hover) .#{$ns}CBGroup-toolbarLeft .#{$ns}Button:not(.is-active) {
      width: 0;
      padding: 0;
      overflow: hidden;
      opacity: 0;
      margin: 0;
      border: 0;
    }

    .#{$ns}CBGroup-toolbarRight {
      transition: opacity 0.2s;
      display: flex;
      align-items: center;

      .#{$ns}CBDelete {
        margin-left: $gap-xs;
      }
    }
    &:not(:hover) .#{$ns}CBGroup-toolbarRight {
      opacity: 0;
    }
  }

  &-field,
  &-operator {
    position: relative;
    display: inline-block;
    margin: px2rem(3px);
    vertical-align: middle;
  }

  &-fieldCaret,
  &-operatorCaret {
    transition: transform 0.3s ease-out;
    margin: 3px;
    display: flex;
    color: $icon-color;
    &:hover {
      color: $icon-onHover-color;
    }

    > svg {
      width: px2rem(12px);
      height: px2rem(12px);
      top: 0;
    }
  }

  &-fieldInput.is-active &-fieldCaret,
  &-operatorInput.is-active &-operatorCaret {
    transform: rotate(180deg);
  }

  &-placeholder {
    color: $text--muted-color;
    position: relative;
    margin-left: 30px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 5px;

    &:before {
      position: absolute;
      content: '';
      top: -10px;
      left: -30px;
      width: 20px;
      border-left: solid 1px $borderColor;
      bottom: 0;
    }

    &:after {
      position: absolute;
      content: '';
      top: 50%;
      width: 20px;
      left: -30px;
      border-top: solid 1px $borderColor;
    }

    &:last-child {
      &:before {
        border-bottom-left-radius: 5px;
        border-bottom: solid 1px $borderColor;
        bottom: 50%;
      }

      &:after {
        display: none;
      }
    }
  }
}

.#{$ns}CBDelete {
  @include icon-color();
  cursor: pointer;
  margin-left: auto;
  transition: opacity 0.2s;
}

.#{$ns}CBGroupOrItem {
  position: relative;
  margin-left: px2rem(30px);

  & + & {
    margin-top: px2rem(10px);
  }

  &-body {
    display: flex;
    padding: 2px 7px;
    border-radius: 5px;
    flex-direction: row;
    align-items: center;
    position: relative;

    background: rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease-out;

    > .#{$ns}CBGroup {
      margin: 3px;
    }
  }

  &-body:not(:hover) .#{$ns}CBDelete {
    opacity: 0;
  }

  &.is-dragging {
    display: none;
  }

  &.is-ghost > &-body:before {
    position: absolute;
    z-index: 2;
    content: '';
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba($info, 0.2);
  }

  &-dragbar {
    cursor: move;
    width: 20px;
    margin-left: -5px;
    opacity: 0;
    text-align: center;
    transition: opacity 0.3s ease-out;
    @include icon-color();
  }

  .#{$ns}CBGroup {
    flex-grow: 1;
  }

  &:hover > &-body {
    background-color: rgba(0, 0, 0, 0.05);
  }

  &:hover > &-body > &-dragbar {
    opacity: 1;
  }

  &:before {
    position: absolute;
    content: '';
    top: -10px;
    left: -30px;
    width: 20px;
    border-left: solid 1px $borderColor;
    bottom: 0;
  }

  &:after {
    position: absolute;
    content: '';
    top: 50%;
    width: 20px;
    left: -30px;
    border-top: solid 1px $borderColor;
  }

  &:last-child {
    &:before {
      border-bottom-left-radius: 5px;
      border-bottom: solid 1px $borderColor;
      bottom: 50%;
    }

    &:after {
      display: none;
    }
  }
}

.#{$ns}CBInputSwitch {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  // margin: px2rem(3px);
  cursor: pointer;
  > a {
    @include icon-color();
  }

  svg {
    width: px2rem(10px);
    height: px2rem(10px);
  }
}

.#{$ns}CBFunc {
  display: inline-block;
  vertical-align: middle;
  margin: px2rem(3px);

  &-select {
    display: inline-block;
    position: relative;
  }

  &-error {
    color: $danger;
  }

  &-args {
    display: inline-block;
    > span {
      display: inline-block;
      padding: 0 5px;
      color: $info;
    }

    > div {
      display: inline-block;
    }
  }
}

.#{$ns}CBValue {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin: px2rem(3px);
}

.#{$ns}CBSeprator {
  width: 20px;
  text-align: center;
  display: inline-block;
  user-select: none;
}
